package com.gomore.opple.module;

import android.app.Activity;
import android.content.Intent;

import com.gomore.opple.model.Good;
import com.gomore.opple.module.account.AccountActivity;
import com.gomore.opple.module.addaddress.AddAddressActivity;
import com.gomore.opple.module.addbankcard.AddBankCardActivity;
import com.gomore.opple.module.addcustomer.AddCustomerActivity;
import com.gomore.opple.module.addressdialog.AddressDialogActivity;
import com.gomore.opple.module.award.AwardActivity;
import com.gomore.opple.module.cards.CardsActivity;
import com.gomore.opple.module.gooddetail.GoodDetailActivity;
import com.gomore.opple.module.incomeandexpense.IncomeAndExpenseActivity;
import com.gomore.opple.module.incomeandexpense.detailactivity.ApplyDetailActivity;
import com.gomore.opple.module.incomeandexpense.detailactivity.IncomeAndExpenseDetailActivity;
import com.gomore.opple.module.login.LoginActivity;
import com.gomore.opple.module.lottery.LotteryActivity;
import com.gomore.opple.module.main.MainActivity;
import com.gomore.opple.module.order.OrderActivity;
import com.gomore.opple.module.orderpay.OrderPayActivity;
import com.gomore.opple.module.qrcode.MipcaActivityCapture;
import com.gomore.opple.module.redpackage.RedPackageActivity;
import com.gomore.opple.module.searchgoods.SearchGoodsActivity;
import com.gomore.opple.module.takeandselectphoto.TakeAndSelectPhotoActivity;
import com.gomore.opple.module.view.ViewPictureActivity;
import com.gomore.opple.rest.applybill.ApplyHist;
import com.gomore.opple.utils.AnimationUtils;
import com.gomore.opple.web.cgform.applybill.entity.TOApplyBillEntity;
import com.gomore.opple.web.cgform.consumer.entity.TOConsumerEntity;
import com.gomore.opple.web.cgform.shippingaddr.entity.TOShippingAddrEntity;

/**
 * Company 上海勾芒科技有限公司.
 */
public class IntentStart {

    public static final String GOODID = "goodId";
    public static final String SEARCHKEY = "searchKey";
    public static final String GOOD = "good";
    public static final String ADDRESS = "address";
    public static final String CONSUMER = "consumer";
    public static final String ORDERID = "orderId";
    public static final String ORDERSTATE = "orderState";
    public static final String LOTTERYID = "lotteryId";
    public static final String DRAWID = "drawId";
    public static final String APPLYHIST = "ApplyHist";
    public static final String TOAPPLYBILLENTITY = "TOApplyBillEntity";
    public static final String FRAGMENT_TYPE = "fragment_type";
    public static final String POSITION = "position";
    public static final String STORECODE = "storeCode";
    private static IntentStart intentStart;

    private IntentStart() {

    }

    public static IntentStart getInstance() {
        if (intentStart == null) {
            intentStart = new IntentStart();
        }
        return intentStart;
    }

    public void startLoginActivity(Activity activity) {
        Intent intent = new Intent(activity, LoginActivity.class);
        activity.startActivity(intent);
        AnimationUtils.showActivityExitAnim(activity);
    }

    public void startMainActivity(Activity activity) {
        Intent intent = new Intent(activity, MainActivity.class);
        activity.startActivity(intent);
        AnimationUtils.showActivityExitAnim(activity);
    }

    public void startAddConsumerActivity(Activity activity, TOConsumerEntity toConsumerEntity) {
        Intent intent = new Intent(activity, AddCustomerActivity.class);
        intent.putExtra(CONSUMER, toConsumerEntity);
        activity.startActivity(intent);
        AnimationUtils.showActivityExitAnim(activity);
    }

    public void startGoodDetailActivity(Activity activity, String goodId) {
        Intent intent = new Intent(activity, GoodDetailActivity.class);
        intent.putExtra(GOODID, goodId);
        activity.startActivity(intent);
        AnimationUtils.showActivityExitAnim(activity);
    }

    public void startSearchGoodsActivity(Activity activity, String key) {
        Intent intent = new Intent(activity, SearchGoodsActivity.class);
        intent.putExtra(SEARCHKEY, key);
        activity.startActivity(intent);
        AnimationUtils.showActivityExitAnim(activity);
    }

    public void startMipcaActivityCaptureActivity(Activity activity, String fragmentType) {
        Intent intent = new Intent(activity, MipcaActivityCapture.class);
        intent.putExtra(FRAGMENT_TYPE, fragmentType);
        activity.startActivity(intent);
        AnimationUtils.showActivityExitAnim(activity);
    }

    public void startAccountActivity(Activity activity, Good good) {
        Intent intent = new Intent(activity, AccountActivity.class);
        intent.putExtra(GOOD, good);
        activity.startActivity(intent);
        AnimationUtils.showActivityExitAnim(activity);
    }

    public void startAddAddressActivity(Activity activity, TOShippingAddrEntity toShippingAddrEntity) {
        Intent intent = new Intent(activity, AddAddressActivity.class);
        intent.putExtra(ADDRESS, toShippingAddrEntity);
        activity.startActivity(intent);
        AnimationUtils.showActivityExitAnim(activity);
    }

    public void startOrderPayActivity(Activity activity, String orderId, String orderState) {
        Intent intent = new Intent(activity, OrderPayActivity.class);
        intent.putExtra(ORDERID, orderId);
        intent.putExtra(ORDERSTATE, orderState);
        activity.startActivity(intent);
        AnimationUtils.showActivityExitAnim(activity);
    }

    public void startLotteryActivity(Activity activity, String lotteryId, String orderNumber, String drawId, String fragmentType) {
        Intent intent = new Intent(activity, LotteryActivity.class);
        intent.putExtra(LOTTERYID, lotteryId);
        intent.putExtra(ORDERID, orderNumber);
        intent.putExtra(DRAWID, drawId);
        intent.putExtra(FRAGMENT_TYPE, fragmentType);
        activity.startActivity(intent);
        AnimationUtils.showActivityExitAnim(activity);
    }

    public void startIncomeAndExpenseActivity(Activity activity) {
        Intent intent = new Intent(activity, IncomeAndExpenseActivity.class);
        activity.startActivity(intent);
        AnimationUtils.showActivityExitAnim(activity);
    }

    public void startAddBankCarActivity(Activity activity) {
        Intent intent = new Intent(activity, AddBankCardActivity.class);
        activity.startActivity(intent);
        AnimationUtils.showActivityExitAnim(activity);
    }

    public void startIncomeAndExpenseDetailActivity(Activity activity, ApplyHist applyHist) {
        Intent intent = new Intent(activity, IncomeAndExpenseDetailActivity.class);
        intent.putExtra(APPLYHIST, applyHist);
        activity.startActivity(intent);
        AnimationUtils.showActivityExitAnim(activity);
    }

    public void startApplyDetailActivity(Activity activity, TOApplyBillEntity toApplyBillEntity) {
        Intent intent = new Intent(activity, ApplyDetailActivity.class);
        intent.putExtra(TOAPPLYBILLENTITY, toApplyBillEntity);
        activity.startActivity(intent);
        AnimationUtils.showActivityExitAnim(activity);
    }

    public void startCardsActivity(Activity activity) {
        Intent intent = new Intent(activity, CardsActivity.class);
        activity.startActivity(intent);
        AnimationUtils.showActivityExitAnim(activity);
    }

    public void startTakeAndSelectPhotoActivity(Activity activity, String fragment_type, int position) {
        Intent intent = new Intent(activity, TakeAndSelectPhotoActivity.class);
        intent.putExtra(FRAGMENT_TYPE, fragment_type);
        intent.putExtra(POSITION, position);
        activity.startActivity(intent);
        AnimationUtils.showActivityExitAnim(activity);
    }

    public void startAwardActivity(Activity activity) {
        Intent intent = new Intent(activity, AwardActivity.class);
        activity.startActivity(intent);
        AnimationUtils.showActivityExitAnim(activity);
    }

    public void startRedPackageActivity(Activity activity) {
        Intent intent = new Intent(activity, RedPackageActivity.class);
        activity.startActivity(intent);
        AnimationUtils.showActivityExitAnim(activity);
    }

    public void startOrderActivity(Activity activity) {
        Intent intent = new Intent(activity, OrderActivity.class);
        activity.startActivity(intent);
        AnimationUtils.showActivityExitAnim(activity);
    }

    public void startViewPictureActivity(Activity activity) {
        Intent intent = new Intent(activity, ViewPictureActivity.class);
        activity.startActivity(intent);
        AnimationUtils.showActivityExitAnim(activity);
    }

    public void startAddressDialogActivity(Activity activity, String storeCode) {
        Intent intent = new Intent(activity, AddressDialogActivity.class);
        intent.putExtra(STORECODE, storeCode);
        activity.startActivity(intent);
        AnimationUtils.showActivityExitAnim(activity);
    }
}
